import React from 'react'
import Cron from 'qnn-react-cron'

function MyCron({ form }) {
  const onChange = (cronExpression) => {
    console.log('Cron Expression:', cronExpression)
  }

  return (
    <Cron
      onChange={onChange}
      onOk={(value) => {
        // 查找value中最后一个空格，并去除后边内容
        const index = value.lastIndexOf(' ')
        value = value.substring(0, index)
        console.log(value)
        form.setFieldsValue({ cron: value })
        
      }}
    />
  )
}

export default MyCron
